#pragma once

namespace Be
{
	class Node
	{
	public:
		Node(Entity* p_pEntity);
		virtual ~Node();

	public:
		void Invalid();

		Entity* GetEntity();

	private:
		Entity* m_pEntity;
		std::wstring m_EntityName;

		bool m_IsValid;

	private:
		template<typename T>
		friend class System;
	};
}

namespace Be
{
	template<typename T>
	class System
	{
	protected:
		System();
		virtual ~System();

	public:
		bool Register(Entity* p_pEntity, typename const T::Seed& p_rSeed);
		void Unregister(Entity* p_pEntity);
		void Update();

	protected:
		T* GetNode(Entity* p_pEntity);

	protected:
		virtual void OnRegister(T* p_pNode, typename const T::Seed& p_rSeed) = 0;
		virtual void OnUnregister(T* p_pNode) = 0;
		virtual void OnUpdate(T* p_pNode) = 0;

	private:
		std::map<Entity*, typename T*> m_NodeMap;
	};
}

#include "System.inl"